package com.xnew.operator.controller;

import com.xnew.aes.LogParameter;
import com.xnew.operator.bean.AcctOperatorLog;
import com.xnew.operator.service.AcctOperatorLogService;
import com.xnew.utils.ConvertEntityUtil;
import com.xnew.utils.DataInput;
import com.xnew.utils.DataOutput;
import com.xnew.utils.MybatisParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * @Author yangchengdong
 */
@RestController
@RequestMapping("/acctOperatorLog")
public class AcctOperatorLogController {

    @Autowired
    private AcctOperatorLogService acctOperatorLogService;

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    /**
     * 操作日志查询
     * */
    @RequestMapping(value = "/selectAll", method = RequestMethod.POST)
    @ResponseBody
    @LogParameter(key = "", desc = "操作日志查询")
    public DataOutput selectAll(@RequestBody DataInput input){
        DataOutput out = DataOutput.success();
        try{
            List<AcctOperatorLog> list = acctOperatorLogService.selectAll(input);
            out = MybatisParam.getOutput(ConvertEntityUtil.convertListData(list));
        }catch (Exception e){
            logger.error(e.getMessage(), e);
            out.setCode(-90001);
            out.setMsg("内控任务列表查询出错");
        }
        return out;
    }
}
